export default{
    //如果要模块化，必须添加namespaced属性，并且让其值为true
    namespaced:true,
    state:{
        num:10
    },
    mutations:{
        SET_NUM(state,payload){
            state.num=state.num+payload
        }
    },
    actions:{
        incrementAsync(cxt,payload){
            setTimeout(() => {
                cxt.commit('SET_NUM',payload)
            }, 3000);
        }
    },
    getters:{
        doubleNum(state){
            return 2*state.num
        }
    }
}